﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>优惠券详情</title>
<link href="css/together.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="StyleSheet" media="all" href="${ctx}/css/combined.css">
<link type="text/css" rel="StyleSheet" media="all" href="${ctx}/css/global.css">
<link href="${ctx}/css/jquery.popup.css" rel="stylesheet" type="text/css">
<link href="${ctx}/css/jquery.treeview.css" rel="stylesheet" type="text/css">
<link href="${ctx}/css/safeai/together.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="${ctx}/js/calendar.js"></script>
<script type="text/javascript" src="${ctx}/js/calendar-zh.js"></script>
<script type="text/javascript" src="${ctx}/js/calendar-setup.js"></script>
<script type="text/javascript">
    if (!Calendar._TT["WEEKEND"]) Calendar._TT["WEEKEND"] = "0,6";
    if (!Calendar._TT["DAY_FIRST"]) Calendar._TT["DAY_FIRST"] = "Display %s first";
	function chen1(){
		document.getElementById("zhuce").style.display="none";
		document.getElementById("jifen").style.display="none";
		document.getElementById("daoru").style.display="none";
		document.getElementById("qita").style.display="block";
	}
	function chen11(obj){
		if(parseInt(obj)==0){
			document.getElementById("zhuce").style.display="block";
			document.getElementById("jifen").style.display="none";
			document.getElementById("daoru").style.display="none";
			document.getElementById("qita").style.display="none";
		}else if(parseInt(obj)==1){
			document.getElementById("zhuce").style.display="none";
			document.getElementById("jifen").style.display="block";
			document.getElementById("daoru").style.display="none";
			document.getElementById("qita").style.display="none";
		}else if(parseInt(obj)==2){
			document.getElementById("zhuce").style.display="none";
			document.getElementById("jifen").style.display="none";
			document.getElementById("daoru").style.display="block";
			document.getElementById("qita").style.display="none";
		}else{
			document.getElementById("zhuce").style.display="none";
			document.getElementById("jifen").style.display="none";
			document.getElementById("daoru").style.display="none";
			document.getElementById("qita").style.display="block";
		}
	}
	function jiaoyan1(){
		if(document.getElementById("created:start1").value == ''||document.getElementById("created:after1").value == ''){
			alert("日期不能为空!");
			return false;
		}else{
			return true;
		}
	}
	function jiaoyan2(){
		if(document.getElementById("created:start2").value == ''||document.getElementById("created:after2").value == ''){
			alert("日期不能为空!");
			return false;
		}else if(document.getElementsByName("jine11")[0].value == ''){
			alert("金额不能为空!");
			return false;
		}else{
			var patrn=/^[0-9]*[1-9][0-9]*$/;
			if(!patrn.exec(document.getElementsByName("jine11")[0].value)){
				alert("金额格式不对!");
				return false;
			}else{
				return true;
			}
		}
	}
</script>
</head>

<body onload="chen1()">
<table align="center" width="98%">
	<tr>
    	<th colspan="4" height="25px">优惠券基本信息</th>
  </tr>
    <tr>
    	<td class="td_01" nowrap width="14%">优惠名称：</td>
        <td class="td_04">${ecoupon.name}</td>
        <td class="td_01" nowrap width="14%">状态：</td>
        <td class="td_04">
			<logic:equal name="ecoupon" property="struts" value="0">
					有效
			</logic:equal>
		    <logic:notEqual name="ecoupon" property="struts" value="0">
					无效
			</logic:notEqual>
		</td>
    </tr>
    <tr>
    	<td class="td_01" nowrap>生效日期：</td>
        <td class="td_04" nowrap>${ecoupon.startimeStr}</td>
        <td class="td_01" nowrap>失效日期：</td>
        <td class="td_04" nowrap>${ecoupon.endtimeStr}</td>
    </tr>
    <tr>
    	<td class="td_01" nowrap>描述信息：</td>
        <td colspan="3" class="td_04">
        	${ecoupon.description}	
        </td>
    </tr>
    <tr>
    	<td class="td_01" nowrap>产品类别：</td>
        <td class="td_04">${catalogName}&nbsp;</td>
        <td class="td_01" nowrap>品牌：</td>
        <td class="td_04">${Brand}&nbsp;</td>
    </tr>
    <tr>
    	<td class="td_01">具体产品：</td>
        <td class="td_04">${productName}&nbsp;</td>
        <td class="td_01" nowrap>订单金额下限：</td>
        <td class="td_04">${ecoupon.minmoney}&nbsp;</td>
    </tr>
    <tr>
    	<td class="td_01" nowrap>优惠券金额：</td>
        <td class="td_04">${ecoupon.favourablemoney}&nbsp;</td>
        <td class="td_01" nowrap>允许使用次数：</td>
        <td class="td_04">${ecoupon.maxtimes}&nbsp;</td>
    </tr>
    <tr>
    	<td class="td_01">优惠券张数：</td>
    	<td class="td_04">${zhangshu}&nbsp;</td>
        <td class="td_01" nowrap>发放方式：</td>
        <td class="td_04">
        	<select id="fafangfangshi" onchange="chen11(this.value)">
        		<option value="0">用户注册赠优惠券</option>
        		<option value="1">消费满额赠优惠券</option>
        		<option value="2">导入Excel赠优惠券</option>
        		<option value="3" selected="selected">其他</option>
        	</select>
        </td>
    </tr>
</table>
	<div id="zhuce" style="display:none">
	<form action="${ctx}/ecoupon.do?method=provide1&fangfa=1" onsubmit="return jiaoyan1();">
		<input type="hidden" name="ecouponID" value="${ecoupon.id}">
		<input type="hidden" name="method" value="provide1">
		<input type="hidden" name="fangfa" value="1">
		活动开始日期：<input name="ecoupon.startimeStr" id="created:start1" value="${ecoupon.startimeStr}"  type="text" / style="background-image:url(${ctx}/images/cal.gif); background-repeat:no-repeat; background-position:left;padding-left:25px; cursor:hand;width:176px"> 
			<script type="text/javascript">
		    	Calendar.setup({
		
		        firstDay       :    0,                  // first day of the week
		        inputField     :    "created:start1",     // id of the input field
		        button         :    "created:start_trigger_c",  // trigger for the calendar (button ID)
		        align          :    "Bl",           // alignment (defaults to "Bl")
		        singleClick    :    true,
		             ifFormat       : "%y/%m/%d"      // our date only format
		         });
            </script>
       	活动结束日期：<input name="ecoupon.endtimeStr" id="created:after1" value="${ecoupon.endtimeStr}"  type="text" / style="background-image:url(${ctx}/images/cal.gif); background-repeat:no-repeat; background-position:left;padding-left:25px; cursor:hand;width:176px"> 
			<script type="text/javascript">
		    	Calendar.setup({
		
		        firstDay       :    0,                  // first day of the week
		        inputField     :    "created:after1",     // id of the input field
		        button         :    "created:after_trigger_c",  // trigger for the calendar (button ID)
		        align          :    "Bl",           // alignment (defaults to "Bl")
		        singleClick    :    true,
		             ifFormat       : "%y/%m/%d"      // our date only format
		         });
            </script>
            <input type="submit" class="btn" value="确定">
		</form>
	</div>
	<div id="jifen" style="display:none">
		<form action="${ctx}/ecoupon.do?method=provide1?fangfa=2" onsubmit="return jiaoyan2();">
			<input type="hidden" name="ecouponID" value="${ecoupon.id}">
			<input type="hidden" name="method" value="provide1">
			<input type="hidden" name="fangfa" value="2">
					活动开始日期：<input name="ecoupon.startimeStr" id="created:start2" value="${ecoupon.startimeStr}"  type="text" / style="background-image:url(${ctx}/images/cal.gif); background-repeat:no-repeat; background-position:left;padding-left:25px; cursor:hand;width:176px"> 
			<script type="text/javascript">
		    	Calendar.setup({
		
		        firstDay       :    0,                  // first day of the week
		        inputField     :    "created:start2",     // id of the input field
		        button         :    "created:start_trigger_c",  // trigger for the calendar (button ID)
		        align          :    "Bl",           // alignment (defaults to "Bl")
		        singleClick    :    true,
		             ifFormat       : "%y/%m/%d"      // our date only format
		         });
            </script>
       	活动结束日期：<input name="ecoupon.endtimeStr" id="created:after2" value="${ecoupon.endtimeStr}"  type="text" / style="background-image:url(${ctx}/images/cal.gif); background-repeat:no-repeat; background-position:left;padding-left:25px; cursor:hand;width:176px"> 
			<script type="text/javascript">
		    	Calendar.setup({
		
		        firstDay       :    0,                  // first day of the week
		        inputField     :    "created:after2",     // id of the input field
		        button         :    "created:after_trigger_c",  // trigger for the calendar (button ID)
		        align          :    "Bl",           // alignment (defaults to "Bl")
		        singleClick    :    true,
		             ifFormat       : "%y/%m/%d"      // our date only format
		         });
            </script>
            金额(元)：<input type="text" name="jine11">
            <input type="submit" class="btn" value="确定">
		</form>
	</div>
	<div id="daoru" style="display:none">
		<html:form action="/ecoupon" enctype="multipart/form-data">
			<input type="hidden" name="ecouponID" value="${ecoupon.id}">
			<input type="hidden" name="method" value="provide1">
			<input type="hidden" name="fangfa" value="3">
			<html:file property="sg.file"/>
			<input type="submit" class="btn" value="确定">
		</html:form>
	</div>
	<div id="qita" style="display:none">
		<form action="${ctx}/ecoupon.do">
		<input type="hidden" name="ecouponID" value="${ecoupon.id}">
		<input type="hidden" name="method" value="provide1">
		<input type="hidden" name="fangfa" value="4">
		<input type="submit" class="btn" value="确定">
		</form>
	</div>
	
</body>
</html>
